home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- Caption = "Form1"
- ClientHeight = 4020
- ClientLeft = 1095
- ClientTop = 1770
- ClientWidth = 7365
- Height = 4710
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 4020
- ScaleWidth = 7365
- Top = 1140
- Width = 7485
- Begin CommandButton cmdExit
- Caption = "E&xit"
- Height = 495
- Left = 5880
- TabIndex = 2
- Top = 3000
- Width = 1215
- End
- Begin TextBox Text1
- Height = 3975
- Left = 0
- TabIndex = 1
- Top = 0
- Width = 5535
- End
- Begin CommandButton cmdOpen
- Caption = "&Open"
- Height = 495
- Left = 5880
- TabIndex = 0
- Top = 360
- Width = 1215
- End
- Begin CommonDialog CMDialog1
- Left = 6120
- Top = 1320
- End
- Begin Menu mnuFile
- Caption = "&File"
- Begin Menu mnuOpen
- Caption = "&Open"
- End
- Begin Menu mnuSep
- Caption = "-"
- End
- Begin Menu mnuexit
- Caption = "E&xit"
- End
- End
- Option Explicit
- Sub cmdExit_Click ()
- End
- End Sub
- Sub cmdOpen_Click ()
- Dim fname As String
- Dim fhandle As Integer
- On Error GoTo ErrOpen
- 'Set properties for Commaon Dialog
- CMDialog1.CancelError = True 'Creates a run time error if hit cancel
- CMDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt"
- CMDialog1.FilterIndex = 2 'Uses text files as default filter
- CMDialog1.InitDir = "C:\VB5Day\Labs" 'Set default path for Dialog box
- 'Display the File Open Dialog Box
- CMDialog1.Action = 1
- 'Capture file name selected
- fname = CMDialog1.Filename
- 'Load file into text box
- fhandle = FreeFile 'Find available handle number
- Open fname For Input As fhandle 'Open as sequential file
- text1.Text = Input$(LOF(fhandle), fhandle)
- Exit Sub
- ErrOpen:
- Select Case Err
- Case 32755
- Exit Sub
- Case Else
- Dim msg As String
- msg$ = "An unexpected error has occurred:" & Chr$(10)
- msg$ = msg$ & "Error#: " & Err & Chr$(10)
- msg$ = msg$ & Error$
- MsgBox msg$, 48, "Error"
- End
- End Select
- End Sub
- Sub mnuexit_Click ()
- End
- End Sub
- Sub mnuOpen_Click ()
- Call cmdOpen_Click
- End Sub
-